package config_manager

import (
	"go_server/game_server/dataconfig/configpb"
	"go_server/game_server/util"
	"go_server/zinx/zlog"
)

func GetStcTableHero_SheetHeroConfig(id int32) (configpb.StcTableHero_SheetHero_220164B4, bool) {
	config, ok := tableHeroSheetHero[id]
	if !ok {
		zlog.Errorf("GetStcTableHero_SheetHeroConfig Err!!! id: %d", id)
		return configpb.StcTableHero_SheetHero_220164B4{}, false
	}
	return configpb.StcTableHero_SheetHero_220164B4{
		Id:           config.Id,
		Skills:       config.Skills,
		Quality:      config.Quality,
		Unlockitemid: config.Unlockitemid,
		UnlockNum:    config.UnlockNum,
		P2Pycap:      config.P2Pycap,
		P2Pyhp:       config.P2Pyhp,
		P2Pyatt:      config.P2Pyatt,
		P2Pydef:      config.P2Pydef,
		P2Hp:         config.P2Hp,
		P2Att:        config.P2Att,
		P2Def:        config.P2Def,
		P2Jhp:        config.P2Jhp,
		P2Jatt:       config.P2Jatt,
		P2Jdef:       config.P2Jdef,
		P2Php:        config.P2Php,
		P2Patt:       config.P2Patt,
		P2Pdef:       config.P2Pdef,
		P2Zhp:        config.P2Zhp,
		P2Zatt:       config.P2Zatt,
		P2Zdef:       config.P2Zdef,
		P2Ghp:        config.P2Ghp,
		P2Gatt:       config.P2Gatt,
		P2Gdef:       config.P2Gdef,
		P2Corn:       config.P2Corn,
		P2Stone:      config.P2Stone,
		P2Iron:       config.P2Iron,
		P2Pet:        config.P2Pet,
		P2Pvemove:    config.P2Pvemove,
		P2Pvpmove:    config.P2Pvpmove,
	}, true
}

// 获得默认解锁的英雄
func GetStcTableHero_SheetHeroConfig_Default_UnlockStatus() []configpb.StcTableHero_SheetHero_220164B4 {
	rstCfgs := make([]configpb.StcTableHero_SheetHero_220164B4, 0)
	if tableHeroSheetHero != nil {
		for _, v := range tableHeroSheetHero {
			if v.UnlockStatus { //默认解锁的英雄
				n := configpb.StcTableHero_SheetHero_220164B4{
					Id:     v.Id,
					Skills: v.Skills,
				}
				rstCfgs = append(rstCfgs, n)
			}
		}
	}
	return rstCfgs
}

func GetStcTableHero_SheetLevelConfig(id int32) (configpb.StcTableHero_SheetLevel_1BF89EB8, bool) {
	config, ok := tableHeroSheetLevel[id]
	if !ok {
		zlog.Errorf("GetStcTableHero_SheetLevelConfig Err!!! id: %d", id)
		return configpb.StcTableHero_SheetLevel_1BF89EB8{}, false
	}
	return configpb.StcTableHero_SheetLevel_1BF89EB8{
		Id:      config.Id,
		Consume: config.Consume,
		Hp:      config.Hp,
		Att:     config.Att,
		Def:     config.Def,
		Cap:     config.Cap,
	}, true
}

func GetStcTableHero_SheetStarConfig(id int32) (configpb.StcTableHero_SheetStar_9F49B1D8, bool) {
	config, ok := tableHeroSheetStar[id]
	if !ok {
		zlog.Errorf("GetStcTableHero_SheetStarConfig Err!!! id: %d", id)
		return configpb.StcTableHero_SheetStar_9F49B1D8{}, false
	}
	return configpb.StcTableHero_SheetStar_9F49B1D8{
		Id:        config.Id,
		Consume1:  config.Consume1,
		Consume2:  config.Consume2,
		Level:     config.Level,
		Hp:        config.Hp,
		Att:       config.Att,
		Def:       config.Def,
		P2Hp:      config.P2Hp,
		P2Att:     config.P2Att,
		P2Def:     config.P2Def,
		P2Jhp:     config.P2Jhp,
		P2Jatt:    config.P2Jatt,
		P2Jdef:    config.P2Jdef,
		P2Php:     config.P2Php,
		P2Patt:    config.P2Patt,
		P2Pdef:    config.P2Pdef,
		P2Zhp:     config.P2Zhp,
		P2Zatt:    config.P2Zatt,
		P2Zdef:    config.P2Zdef,
		P2Ghp:     config.P2Ghp,
		P2Gatt:    config.P2Gatt,
		P2Gdef:    config.P2Gdef,
		P2Corn:    config.P2Corn,
		P2Stone:   config.P2Stone,
		P2Iron:    config.P2Iron,
		P2Pet:     config.P2Pet,
		P2Pvemove: config.P2Pvemove,
		P2Pvpmove: config.P2Pvpmove,
	}, true
}

func GetStcTableHeroCell_SheetCell(id int32) (configpb.StcTableHeroCell_SheetCell_166605B4, bool) {
	config, ok := tableHeroSheetCell[id]
	if !ok {
		zlog.Errorf("GetStcTableHeroCell_SheetCell Err!!! id: %d", id)
		return configpb.StcTableHeroCell_SheetCell_166605B4{}, false
	}
	return configpb.StcTableHeroCell_SheetCell_166605B4{
		Id:      config.Id,
		Fusion:  config.Fusion,
		Level:   config.Level,
		Weight:  config.Weight,
		Quality: config.Quality,
	}, true
}

func GetTotal_StcTableHeroCell_SheetCell() []int32 {
	rst := util.NewSet[int32]()
	if len(tableHeroSheetCell) > 0 {
		for id, _ := range tableHeroSheetCell {
			rst.Add(id)
		}
	}
	return rst.Elements()
}

func GetTotal_StcTableHero_SheetStar() []int32 {
	rst := util.NewSet[int32]()
	if len(tableHeroSheetStar) > 0 {
		for id, _ := range tableHeroSheetStar {
			rst.Add(id)
		}
	}
	return rst.Elements()
}

func GetTotal_StcTableHero_SheetLevel() []int32 {
	rst := util.NewSet[int32]()
	if len(tableHeroSheetLevel) > 0 {
		for id, _ := range tableHeroSheetLevel {
			rst.Add(id)
		}
	}
	return rst.Elements()
}
